home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 368 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. Path: solon.com!not-for-mail
  2. From: weather@netside.com (Russ Weathersby)
  3. Newsgroups: comp.std.c,comp.lang.c.moderated
  4. Subject: Re: Integral promotion.
  5. Date: 24 Feb 1996 09:44:46 -0600
  6. Organization: The Netside Network
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4gnbpe$bmv@solutions.solon.com>
  10. References: <4fstj7$2l6@solutions.solon.com> <4fvgvb$e0t@solutions.solon.com> <4gfgfp$3k8@solutions.solon.com> <4gjd3g$nt9@solutions.solon.com>
  11. Reply-To: weather@netside.com (Russ Weathersby)
  12. NNTP-Posting-Host: solutions.solon.com
  13. X-Newsreader: IBM NewsReader/2 v1.2
  14.  
  15. In <4gjd3g$nt9@solutions.solon.com>, encom@jolt.mpx.com.au (Encom Technology Sydney) writes:
  16. :Re: short = short + short causing a warning.
  17. :
  18. :This is all getting off the track.  Since only a warning is generated this
  19. :has very little to do with the standard.  I think the point is why does
  20. :
  21. :short = short + short;
  22. :
  23. :generate a warning whereas
  24. :
  25. :int = int + int;
  26. :
  27. :does not.  Both these statements are as prone to overflow as each other
  28. :(although in the first case it may not happen until the int resulting
  29. :from the addition is moved into the short if sizeof(int) > sizeof(short).
  30. :
  31. :The warning is even sillier since on the implementation mentioned
  32. :ints and shorts are the same.
  33.  
  34. I do not own, nor have I read, a copy of the ANSI standard.  That said,
  35. ints in my experience have 'special status' in that it is usually the
  36. machine word size, sort of like an atomic data unit, whereas shorts
  37. are an artificial construction.  Even though the two have the same size
  38. in the example, this may nevertheless influence the behavior of the
  39. compiler.
  40.  
  41. R.Weathersby
  42.